<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-08-06 21:14:27
 * @LastEditTime: 2020-03-23 14:29:44
 * @LastEditors: Please set LastEditors
 -->
<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport"
			content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0,viewport-fit=cover" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>Hello APP</title>
		<link rel="stylesheet" type="text/css" href="../css/vant.css">
		<link rel="stylesheet" type="text/css" href="../css/base.css" />
		<link rel="stylesheet" type="text/css" href="../css/local.css" />
		<script type="text/javascript" src="../script/jquery.js"></script>
		<script type="text/javascript" src="../script/masonry.min.js"></script>
		<script type="text/javascript" src="../script/layer/mobile/layer.js"></script>
		<script type="text/javascript" src="../script/vue.min.js"></script>
		<script type="text/javascript" src="../script/vant.min.js"></script>
		<script type="text/javascript" src="../script/fastclick.js"></script>
		<script type="text/javascript" src="../script/base.js"></script>
		<script type="text/javascript" src="../script/db.js"></script>
		<style type="text/css">
			* {
				padding: 0;
				margin: 0;
				box-sizing: border-box;
			}

			.head-index {
				background-color: #51d0d0;
				color: #fff;
				font-weight: 700;
			}

			.content {
				background: #ffffff !important;
				height: 100%;
				overflow-y: auto;
				-webkit-overflow-scrolling: touch;
			}

			.van-search {
				padding-bottom: 0;
				padding-top: 5px;
				background-color: transparent;
			}

			a {
				text-decoration: none;
				color: #000;
			}

			[v-cloak] {
				display: none !important;
			}

			img {
				width: 100%;
				height: auto;
				display: block;
				border: 0;
			}

			body {
				background: #fff;
				color: #666;
			}


			/* 必要布局样式css */





			.t-i {
				width: 90px;
				margin: 0 auto;
				padding: 8px;
				border-radius: 100px;
				overflow: hidden;
				margin-top: -20px;
			}

			.t-i img {
				display: block;
				width: 100%;
				height: 100%;
				border: none;
			}

			.t-v {
				display: inline-block;
				text-align: center;
				font-size: 0.9rem;
				font-weight: normal;
				color: #fff;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
				/* padding-top: 0.2rem; */
				/* padding: 0 8px 0 8px; */
				padding: 6px 8px;
				/* margin-top: -32px; */
				/* margin-bottom: 4px; */
			}

			.aui-title-time {
				font-weight: normal;
				font-size: 1.1rem;
				color: #e91b4c;
				line-height: 1.4;
				float: left;
			}

			.aui-fleTen {
				padding: 12px 15px;
			}


			.fl-line {
				position: relative;
				font-size: 1rem;
				padding-left: 0.3rem;
			}

			.fl-line:after {
				content: '';
				position: absolute;
				z-index: 0;
				top: 4px;
				left: 0;
				background: #e03a68;
				width: 3px;
				height: 15px;
				border-radius: 100px;
			}

			.aui-flex-box span {
				color: #616161;
				font-size: 0.9rem;
			}



			.mask_a {
				position: absolute;
				bottom: 0;
				width: 100%;
				height: 40px;
				line-height: 40px;
				background: rgba(0, 0, 0, .6);
				z-index: 99;
				color: #fff;
				font-weight: 700;
				text-align: center;
				font-size: 18px;
				letter-spacing: 2px;
			}

			.abc {
				width: 43px !important;
				height: 43px !important;
				margin: 14px auto;
				margin-bottom: 26px;
			}

			.bg {
				background: #efefef;
			}

			.bg .van-search__action i {
				color: #9e9e9e !important;
			}

			.login {
				position: fixed;
				left: 0;
				bottom: 0;
				width: 100%;
			}

			.swipe {
				border-radius: 0;
				overflow: hidden;
			}

			.swipe img {
				width: 100%;
				height: 100%;
			}

			.t {
				padding: 15px 0;
			}

			.e-line {
				height: 10px;
				background-color: #f3f5fb;
			}

			.title {
				color: #000;
				padding: 10px 15px;
				font-size: 18px;
				font-weight: 700;
			}

			.title .f {
				width: 20px;
				float: right;
				vertical-align: middle;
			}

			.shhh {
				padding: 0 15px;
			}

			.hh {
				background-color: #f8f8f8;
				border-radius: 8px;
				margin-bottom: 8px;
				position: relative;
			}

			.hh .h-i {
				border-top-left-radius: 8px;
				border-top-right-radius: 8px;
				overflow: hidden;
			}

			.hh img {
				width: 100%;
				height: 100%;
			}

			.hh .n {
				line-height: 20px;
				font-size: 13px;
				height: 20px;
				color: #504f54;
				margin: 5px 8px;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 1;
				-webkit-box-orient: vertical;
				word-break: break-all;
				padding-bottom: 4px;
			}

			.hh .p {
				color: #51d0d0;
				font-size: 17px;
				padding: 0 8px 8px;
			}

			.rm {
				padding: 0 15px;
			}

			.rm>div {
				overflow: hidden;
				border-radius: 12px;
				background-color: #f6f6f6;
			}

			.rm-sub {
				background-color: #0950ed;
				padding: 10px;
				color: #fff;
				font-size: 14px;
				height: 140px;
			}

			.h-shad {
				box-shadow: 0px 0px 8px rgb(228, 228, 228);
			}

			.tagg {
				padding: 0 8px 8px 8px;
				height: 28px;
			}

			.tag-1 {
				background: rgba(220, 89, 94, 0.1);
				font-size: 12px;
				transform: scale(0.9);
				display: inline-block;
				-webkit-transform-origin-x: 0;
				padding: 0 4px;
				color: #51d0d0;
				margin-right: 6px;
				border-radius: 2px;
				height: 18px;
			}

			.tag-2 {
				background: rgba(25, 137, 250, 0.1);
				font-size: 12px;
				transform: scale(0.9);
				display: inline-block;
				-webkit-transform-origin-x: 0;
				padding: 0 4px;
				color: #1989fa;
				margin-right: 6px;
				border-radius: 2px;
				height: 18px;
			}

			.b {
				position: absolute;
				left: -12px;
				top: 2px;
				width: 60px;
				height: 25px;
				background: url(../image/b.png) no-repeat;
				background-size: 100% 100%;
				text-align: center;
				font-size: 12px;
				color: #fff;
				line-height: 25px;
				transform: scale(0.8);
			}

			.h-b {
				border: 3px solid #0971ed;
				border-bottom: 0;
			}

			.h-bb {
				background-image: linear-gradient(to right, #0971ed, #0946ed);
				font-size: 12px;
				color: #fff;
				line-height: 20px;
				height: 20px;
				/* padding: 0 8px; */
				text-align: center;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 1;
				-webkit-box-orient: vertical;
				word-break: break-all;
			}

			.tagg-s {
				padding-top: 0;
				padding-bottom: 4px;
				margin-top: -8px;
			}

			.tc img {
				width: 100%;
			}

			.kj img {
				width: 100%;
			}
		</style>
	</head>

	<body>
		<div id="app" v-cloak>
			<div class="init-full">
				<div class="head-index">
					<div style="overflow: hidden;">
						<form action="" class="flex-box">
							<div style="padding: 9px 0 0 15px;" @click="openScan">
								<img id="scan" src="../image/scan-b.png" style="width: 26px;vertical-align: middle;" />
							</div>
							<van-search placeholder="输入编码、品牌、品类、名称搜索" v-model="searchKey" @search="getSearch"
								shape="round" show-action class="flex-main">
								<div slot="action" style="padding: 0 10px;">
									<span style="font-size: 14px;color: #fff;" @click="getSearch">搜索</span>
									<!-- <img id="kf" src="../image/kf-b.png" style="width: 26px;vertical-align: middle;"
										@click="openChat" /> -->
								</div>
							</van-search>
						</form>
					</div>

					<div style="white-space: nowrap;width: 100%;overflow-x: auto;">
						<div v-for="row in typeList" v-show="row.ParentCategoryId == 0" class="t-v"
							@click="intoType(row)">
							{{row.Name}}
						</div>
					</div>

				</div>

				<div class="body-no-bottom">
					<van-pull-refresh :disabled="loadingDisabled" v-model="refreshLoading" @refresh="onRefresh">
						<div class="content">
							<div>
								<van-swipe :autoplay="5000" indicator-color="white" :stop-propagation="false"
									:show-indicators="false">
									<van-swipe-item v-for="row in activityBanner" @click="openUrl(row)">
										<div class="swipe">
											<div>
												<img :src="row.Pic_Path">
											</div>
										</div>
									</van-swipe-item>
								</van-swipe>
							</div>





							<!-- <div style="padding: 15px;">
							<van-row gutter="10">
								<van-col :span="12">
									<div class="kj" @click="intoTypeByName('车用油品')"><img src="../image/fldscp.png" />
									</div>
								</van-col>
								<van-col :span="12">
									<div class="kj" @click="intoTypeByName('制动系统')"><img src="../image/jdczdy.png" />
									</div>
								</van-col>
							</van-row>
						</div> -->

							<div>
								<div class="title"><span>实惠好货</span><img src="../image/f.png" class="f" /></div>
								<div class="shhh">
									<van-row gutter="4">
										<van-col :span="8" v-for="row in goodList" style="margin-bottom: 4px;">
											<div class="hh" @click="intoDetail(row)"
												style="box-shadow: 1px 1px 12px -9px #999;">
												<div class="h-i" style="background-color: #fff;">
													<van-image width="100%" height="200px" fit="contain"
														:src="row.ThumbnailUrl410" />
													<!-- <img :src="row.ThumbnailUrl410" alt=""> -->
												</div>
												<div class="n">{{row.ProductName}}</div>
											</div>
										</van-col>
									</van-row>
								</div>
							</div>



							<!-- <div style="padding: 15px;" v-if="activityCenter.length">
							<van-swipe :autoplay="5000" indicator-color="white" :stop-propagation="false"
								:show-indicators="false">
								<van-swipe-item v-for="row in activityCenter" @click="openUrl(row)">
									<div class="swipe">
										<div>
											<img :src="row.Pic_Path">
										</div>
									</div>
								</van-swipe-item>
							</van-swipe>
						</div> -->

							<!-- <div>
							<div class="title"><span>热卖推荐</span><img src="../image/f.png" class="f" /></div>
							<div class="rm">
								<div>
									<div class="rm-sub">
										<div>品质好货一站购</div>
									</div>
									<div style="padding: 0 10px;margin-top: -100px;">
										<van-row gutter="8">
											<van-col :span="12" v-for="row in hostList">
												<div class="hh h-shad" @click="intoDetail(row)">
													<div class="h-i" :style="{height:getImgHeight(1)}">
														<img :src="row.ThumbnailUrl410" alt="">
													</div>

													<div class="n">{{row.ProductName}}</div>
													<div class="tagg"><span v-for="(tagItem,index) in getTagArray(row)"
															:class="index%2==0?'tag-1':'tag-2'"
															v-if="tagItem && tagItem.indexOf('套餐') == -1">{{tagItem}}</span>
													</div>
													<div class="b"><span>{{row.CategoryName}}</span></div>
												</div>
											</van-col>
										</van-row>
									</div>
								</div>


							</div>
						</div> -->

							<div>
								<div class="title"><span>优质工具</span><img src="../image/f.png" class="f" /></div>
								<div class="shhh">
									<van-row gutter="5">
										<van-col :span="8" v-for="row in boutiqueList">
											<div class="hh h-shad" style="background: #fff;" @click="intoDetail(row)">
												<div class="h-i h-b" :style="{height:getImgHeight(2)}">
													<img :src="row.ThumbnailUrl410" alt="">
												</div>
												<div class="h-bb">优质工具 实惠好货</div>
												<div class="n">{{row.ProductName}}</div>
												<div class="tagg tagg-s"><span
														v-for="(tagItem,index) in getTagArray(row)"
														:class="index%2==0?'tag-1':'tag-2'"
														v-if="tagItem && tagItem.indexOf('套餐') == -1">{{tagItem}}</span>
												</div>
											</div>
										</van-col>
									</van-row>
								</div>
							</div>

							<!-- <div style="padding: 15px;" v-if="activityCenterTop.length">
							<van-swipe :autoplay="5000" indicator-color="white" :stop-propagation="false"
								:show-indicators="false">
								<van-swipe-item v-for="row in activityCenterTop" @click="openUrl(row)">
									<div class="swipe">
										<div>
											<img :src="row.Pic_Path">
										</div>
									</div>
								</van-swipe-item>
							</van-swipe>
						</div> -->



							<div style="padding: 15px;" v-if="activityBottom.length">
								<van-swipe :autoplay="5000" indicator-color="white" :stop-propagation="false"
									:show-indicators="false">
									<van-swipe-item v-for="row in activityBottom" @click="openUrl(row)">
										<div class="swipe">
											<div>
												<img :src="row.Pic_Path">
											</div>
										</div>
									</van-swipe-item>
								</van-swipe>
							</div>


						</div>
					</van-pull-refresh>
				</div>

			</div>
			<!-- <div class="login">
				<van-notice-bar v-if="!userInfo" wrapable :scrollable="false" background="rgba(255, 251, 232, 0.8)"
					@click="loginAPP">您还未登录,请登录后查看更多内容</van-notice-bar>
			</div> -->

		</div>
	</body>

	<!-- 调用 uniapp webview 的 api ，记得需要写在 body 标签下面 -->
	<script src="../../../assets/script/uni.webview.1.5.4.js"></script>
	<script type="text/javascript">
		var vm;
		//$('.init-full').show();

		Vue.use(vant.Lazyload, {
			loading: '../image/no.png',
			error: '../image/no.png'
		});

		vm = new Vue({
			el: '#app',
			data: {
				Version: '', // APP版本号
				tabbarActive: 0,
				showLoading: false,
				loadingDisabled: false,
				refreshLoading: false,
				// userInfo: FLD.getUserInfo() || '',
				// serverIP: 'http://' + FLD.serverIP,
				// shoppingMallServerIP: 'http://' + FLD.shoppingMallServerIP,

				userInfo: '',
				serverIP: '',
				shoppingMallServerIP: '',
				searchKey: '',
				city: [],
				location: [],
				activityBanner: [],
				activityCenterTop: [],
				activityCenter: [],
				activityBottom: [],
				typeList: [],
				hostList: [],
				goodList: [],
				boutiqueList: [],
				brandList: []
			},
			created: function() {
				var that = this;

				// 因为页面是跳转形式的，有些缓存得清一下
				window.localStorage.removeItem('detailTypeList');
				window.localStorage.removeItem('PageForm');
				// var appTop = parseInt(window.localStorage.getItem('safeAreaTop'));

				// if (appTop) {
				// 	$('.head-index').css({
				// 		'padding-top': appTop + 'px',
				// 		'height': appTop + 80 + 'px',
				// 		'line-height': '40px'
				// 	})
				// }

				// if (FLD.getUserInfo()) {
				// 	that.getNewUserData();
				// }

				// 获取登录信息
				that.IsLogin()

				//获取轮播
				that.getActivityRole();
				//商品分类
				that.getTypes();
				//精品
				that.getBoutique();
				//热销
				that.getSellWell();
				//好货
				that.getGoodShop();
				//中间广告1
				that.getActivityCenterTop();
				//中间广告2
				that.getActivityCenter();
				//底部广告
				that.getActivityBottom();
				//品牌
				// that.getStBrand();


			},
			methods: {
				IsLogin() { // 获取商城的用户信息
					var that = this;
					let data = {
						phone: '13586836674',
						pwd: '123456'
					}
					FLD.shoppingMallAjax('LoginUser', data, function(res) {
						// window.localStorage.setItem('systemType', api.systemType);
						// console.log(JSON.stringify(res))
						if (res.status == 200) {
							// console.log(JSON.stringify(res.data.Table[0]))
							FLD.getUserInfo(JSON.stringify(res.data.Table[0]))

						}
						// var data = JSON.parse(res);
					})
				},
				GetVersion(data) { // 获取版本号
					var that = this;
					that.Version = data;
					window.localStorage.setItem('Version', data);

					that.getActivityRole();
				},
				getImgHeight(index) {
					// if (index == 1) {
					// 	return (api.winWidth - 58) / 2 + 'px';
					// }
					// if (index == 2) {
					// 	return (api.winWidth - 46) / 3 + 'px';
					// }
					return (760 - 46) / 3 + 'px';
				},
				getTagArray(item) {
					var that = this;
					if (!item.TagNames) {
						return [];
					} else {
						return item.TagNames.split(',');
					}
				},
				openScan() {
					// FNScanner.open({
					// 	autorotation: true
					// }, function(ret, err) {
					// 	if (ret) {
					// 		if (ret.eventType == 'success') {
					// 			var obj = {
					// 				S_Type: 60,
					// 				S_Cont: '',
					// 				S_BranchID: 0,
					// 				S_SXZ: '',
					// 				S_StockID: 0,
					// 				S_CargoID: 0,
					// 				S_BarCode: ret.content,
					// 				S_PriceN: 0,
					// 				S_ProductID: 0
					// 			}
					// 			// FLD.ajax('AP_BasList', obj, function(res) {
					// 			// 	if (res.ds.length == 0) {
					// 			// 		layer.open({
					// 			// 			content: '当前二维码未查询到商品!',
					// 			// 			skin: 'msg',
					// 			// 			time: 2
					// 			// 		});
					// 			// 		return false;
					// 			// 	}
					// 			// 	var reg = /[\u4e00-\u9fa5]/g;
					// 			// 	var name = res.ds[0].name.replace(/-/g, '').replace(reg, '');
					// 			// 	var obj = {
					// 			// 		keyName: name,
					// 			// 		parentCategoryId1: 0,
					// 			// 		parentCategoryId2: 0,
					// 			// 		categoryId: 0,
					// 			// 		brandId: 0,
					// 			// 		tagId: 0,
					// 			// 		pageIndex: 1,
					// 			// 		pageSize: 20
					// 			// 	}
					// 			// 	// FLD.ajax('sp_searchProducts', obj, function(res) {
					// 			// 	// 	if (res.ds.length) {
					// 			// 	// 		// api.openWin({
					// 			// 	// 		// 	name: 'product',
					// 			// 	// 		// 	url: 'product.html',
					// 			// 	// 		// 	reload: true,
					// 			// 	// 		// 	slidBackEnabled: false,
					// 			// 	// 		// 	pageParam: {
					// 			// 	// 		// 		productData: res.ds[0],
					// 			// 	// 		// 		stepIndex: 1
					// 			// 	// 		// 	}
					// 			// 	// 		// })
					// 			// 	// 	} else {
					// 			// 	// 		layer.open({
					// 			// 	// 			content: '当前二维码未查询到商品!',
					// 			// 	// 			skin: 'msg',
					// 			// 	// 			time: 2
					// 			// 	// 		});
					// 			// 	// 	}
					// 			// 	// })

					// 			// })
					// 		}
					// 	} else {
					// 		layer.open({
					// 			content: '扫描失败!',
					// 			skin: 'msg',
					// 			time: 2
					// 		});

					// 	}
					// });
				},
				openChat() {
					var that = this;
					// api.sendEvent({
					// 	name: 'openChat'
					// });
				},
				onRefresh() { // 下拉刷新
					var that = this;
					that.refreshLoading = true;
					//获取轮播
					that.getActivityRole();
					//商品分类
					that.getTypes();
					//精品
					that.getBoutique();
					//热销
					that.getSellWell();
					//好货
					that.getGoodShop();
					//中间广告1
					that.getActivityCenterTop();
					//中间广告2
					that.getActivityCenter();
					//底部广告
					that.getActivityBottom();
					//品牌
					// that.getStBrand();
				},
				getBannerHeight() {
					var that = this;
					return (760 - 30) * 0.37 + 'px'
				},
				getNewUserData() {
					var that = this;
					// FLD.ajax('sp_getMemberInfo', {}, function(res) {
					// 	that.userInfo = res.ds[0];
					// 	window.localStorage.setItem('userInfo', JSON.stringify(res.ds[0]));

					// })
				},
				getStBrand() {
					var that = this;
					// FLD.ajax('sp_getBrand', {}, function(res) {
					// 	var brandList = res.ds;
					// 	var repeatImageCache = function(x) {
					// 		if (x == brandList.length) {
					// 			that.brandList = brandList;
					// 			return false;
					// 		} else {
					// 			// api.imageCache({
					// 			// 	url: that.shoppingMallServerIP + brandList[x].Logo,
					// 			// 	thumbnail: false
					// 			// }, function(ret, err) {
					// 			// 	var url = ret.url;
					// 			// 	brandList[x].Logo = url;
					// 			// 	x++;
					// 			// 	repeatImageCache(x)
					// 			// });

					// 		}
					// 	}
					// 	repeatImageCache(0);
					// })
				},
				getActivityRole() { // 获取轮播图
					var that = this;
					FLD.ajax('sp_getAdList', {
						RegType: '首页顶部'
					}, function(res) {
						// console.log(JSON.stringify(res))

						setTimeout(function() {
							that.refreshLoading = false;
						}, 1000)

						let activityBanner = JSON.parse(JSON.stringify(res.ds));

						// 直接给图片重新赋值，防止闪
						activityBanner.map(item => {
							item.Pic_Path = 'http://' + FLD.shoppingMallServerIP + item.Pic_Path
						})

						that.activityBanner = activityBanner;
					})
				},
				getActivityCenterTop() {
					var that = this;
					// FLD.ajax('sp_getAdList', {
					// 	RegType: '首页中间1'
					// }, function(res) {
					// 	setTimeout(function() {
					// 		that.refreshLoading = false;
					// 	}, 1000)

					// 	var activityCenterTop = res.ds;
					// 	var repeatImageCache = function(x) {
					// 		if (x == activityCenterTop.length) {
					// 			that.activityCenterTop = activityCenterTop;
					// 			return false;
					// 		} else {
					// 			// api.imageCache({
					// 			// 	url: that.shoppingMallServerIP + activityCenterTop[x]
					// 			// 		.Pic_Path,
					// 			// 	thumbnail: false
					// 			// }, function(ret, err) {
					// 			// 	var url = ret.url;
					// 			// 	activityCenterTop[x].Pic_Path = url;
					// 			// 	x++;
					// 			// 	repeatImageCache(x)
					// 			// });

					// 		}
					// 	}
					// 	repeatImageCache(0);
					// })
				},
				getActivityCenter() {
					var that = this;
					// FLD.ajax('sp_getAdList', {
					// 	RegType: '首页中间2'
					// }, function(res) {
					// 	setTimeout(function() {
					// 		that.refreshLoading = false;
					// 	}, 1000)

					// 	var activityCenter = res.ds;
					// 	var repeatImageCache = function(x) {
					// 		if (x == activityCenter.length) {
					// 			that.activityCenter = activityCenter;
					// 			return false;
					// 		} else {
					// 			// api.imageCache({
					// 			// 	url: that.shoppingMallServerIP + activityCenter[x].Pic_Path,
					// 			// 	thumbnail: false
					// 			// }, function(ret, err) {
					// 			// 	var url = ret.url;
					// 			// 	activityCenter[x].Pic_Path = url;
					// 			// 	x++;
					// 			// 	repeatImageCache(x)
					// 			// });

					// 		}
					// 	}
					// 	repeatImageCache(0);
					// })
				},
				getActivityBottom() {
					var that = this;
					// FLD.ajax('sp_getAdList', {
					// 	RegType: '首页底部'
					// }, function(res) {
					// 	setTimeout(function() {
					// 		that.refreshLoading = false;
					// 	}, 1000)

					// 	var activityBottom = res.ds;
					// 	var repeatImageCache = function(x) {
					// 		if (x == activityBottom.length) {
					// 			that.activityBottom = activityBottom;
					// 			return false;
					// 		} else {
					// 			// api.imageCache({
					// 			// 	url: that.shoppingMallServerIP + activityBottom[x].Pic_Path,
					// 			// 	thumbnail: false
					// 			// }, function(ret, err) {
					// 			// 	var url = ret.url;
					// 			// 	activityBottom[x].Pic_Path = url;
					// 			// 	x++;
					// 			// 	repeatImageCache(x)
					// 			// });

					// 		}
					// 	}
					// 	repeatImageCache(0);
					// })
				},
				getTypes() { // 获取顶部 tab 分类
					var that = this;
					FLD.ajax('sp_allProductType', {}, function(res) {
						// console.log(JSON.stringify(res))
						var typeList = res.ds;
						that.typeList = typeList;

					})
					// FLD.ajax('sp_allProductType', {}, function(res) {
					// 	var typeList = res.ds;
					// 	var repeatImageCache = function(x) {
					// 		if (x == typeList.length) {
					// 			that.typeList = typeList;
					// 			return false;
					// 		} else {
					// 			if (typeList[x].ParentCategoryId == 0) {
					// 				// api.imageCache({
					// 				// 	url: that.shoppingMallServerIP + typeList[x].Icon,
					// 				// 	thumbnail: false
					// 				// }, function(ret, err) {
					// 				// 	var url = ret.url;
					// 				// 	typeList[x].Icon = url;
					// 				// 	x++;
					// 				// 	repeatImageCache(x)
					// 				// });
					// 			} else {
					// 				x++;
					// 				repeatImageCache(x)
					// 			}

					// 		}
					// 	}
					// 	repeatImageCache(0);
					// })
				},
				getSellWell() {
					var that = this;
					// FLD.ajax('sp_getRecomProduct', {
					// 	Type: '热销'
					// }, function(res) {
					// 	var hostList = res.ds;
					// 	var repeatImageCache = function(x) {
					// 		if (x == hostList.length) {
					// 			that.hostList = hostList;
					// 			return false;
					// 		} else {
					// 			// api.imageCache({
					// 			// 	url: that.shoppingMallServerIP + hostList[x].ThumbnailUrl410,
					// 			// 	thumbnail: false
					// 			// }, function(ret, err) {
					// 			// 	var url = ret.url;
					// 			// 	hostList[x].ThumbnailUrl410 = url;
					// 			// 	x++;
					// 			// 	repeatImageCache(x)
					// 			// });

					// 		}
					// 	}
					// 	repeatImageCache(0);

					// })
				},
				getGoodShop() {
					var that = this;
					FLD.ajax('sp_getRecomProduct', {
						Type: '好货'
					}, function(res) {
						// console.log(JSON.stringify(res.ds))
						var goodList = JSON.parse(JSON.stringify(res.ds));
						// 直接给图片重新赋值，防止闪
						goodList.map(item => {
							item.ThumbnailUrl410 = 'http://' + FLD.shoppingMallServerIP + item
								.ThumbnailUrl410
						})
						that.goodList = goodList;

					})
					// FLD.ajax('sp_getRecomProduct', {
					// 	Type: '好货'
					// }, function(res) {
					// 	var goodList = res.ds;
					// 	// console.log(JSON.stringify(goodList))
					// 	var repeatImageCache = function(x) {
					// 		if (x == goodList.length) {
					// 			that.goodList = goodList;

					// 			return false;
					// 		} else {
					// 			// api.imageCache({
					// 			// 	url: that.shoppingMallServerIP + goodList[x].ThumbnailUrl410,
					// 			// 	thumbnail: false
					// 			// }, function(ret, err) {
					// 			// 	var url = ret.url;
					// 			// 	goodList[x].ThumbnailUrl410 = url;
					// 			// 	x++;
					// 			// 	repeatImageCache(x)
					// 			// });


					// 		}
					// 	}
					// 	repeatImageCache(0);

					// })
				},
				getBoutique() { // 优质工具
					var that = this;
					FLD.ajax('sp_getRecomProduct', {
						Type: '精品'
					}, function(res) {
						// console.log(JSON.stringify(res.ds))
						var boutiqueList = JSON.parse(JSON.stringify(res.ds));
						// 直接给图片重新赋值，防止闪
						boutiqueList.map(item => {
							item.ThumbnailUrl410 = 'http://' + FLD.shoppingMallServerIP + item
								.ThumbnailUrl410
						})
						that.boutiqueList = boutiqueList;

					})


					// FLD.ajax('sp_getRecomProduct', {
					// 	Type: '精品'
					// }, function(res) {
					// 	var boutiqueList = res.ds;
					// 	var repeatImageCache = function(x) {
					// 		if (x == boutiqueList.length) {
					// 			that.boutiqueList = boutiqueList;
					// 			return false;
					// 		} else {
					// 			// api.imageCache({
					// 			// 	url: that.shoppingMallServerIP + boutiqueList[x]
					// 			// 		.ThumbnailUrl410,
					// 			// 	thumbnail: false
					// 			// }, function(ret, err) {
					// 			// 	var url = ret.url;
					// 			// 	boutiqueList[x].ThumbnailUrl410 = url;
					// 			// 	x++;
					// 			// 	repeatImageCache(x)
					// 			// });

					// 		}
					// 	}
					// 	repeatImageCache(0);
					// })
				},
				intoList(row) {
					var that = this;

					// api.openWin({
					// 	name: 'productList',
					// 	url: 'productList.html',
					// 	reload: true,
					// 	slidBackEnabled: false,
					// 	pageParam: {
					// 		brandId: row.BrandId
					// 	}
					// })

				},
				getSearch() {
					var that = this;

					// window.localStorage.setItem('searchKey', that.searchKey);
					// window.location.href = './productList.html';

					uni.navigateTo({
						url: "/pages/qms/shop/CommonPage?url=productList&searchKey=" + that.searchKey
					});

					// api.openWin({
					// 	name: 'productList',
					// 	url: 'productList.html',
					// 	reload: true,
					// 	slidBackEnabled: false,
					// 	pageParam: {
					// 		searchKey: that.searchKey
					// 	}
					// })
				},
				intoDetail(row) {
					var that = this;

					window.localStorage.setItem('productData', JSON.stringify(row))
					window.localStorage.setItem('stepIndex', JSON.stringify(1))
					window.location.href = './product.html'

					// api.openWin({
					// 	name: 'product',
					// 	url: 'product.html',
					// 	reload: true,
					// 	slidBackEnabled: false,
					// 	pageParam: {
					// 		productData: row,
					// 		stepIndex: 1
					// 	}
					// })
				},
				intoType(row) {
					var that = this;

					var detailTypeList = that.typeList.filter(function(item) {
						return item.ParentCategoryId == row.CategoryId;
					})
					for (var i in detailTypeList) {
						var node = [];
						for (var j in that.typeList) {
							if (detailTypeList[i].CategoryId == that.typeList[j].ParentCategoryId) {
								node.push(that.typeList[j])
							}
						}
						detailTypeList[i].typeNode = node;
					}



					uni.navigateTo({
						url: "/pages/qms/shop/CommonPage?url=channel&detailTypeList=" + encodeURIComponent(
							JSON
							.stringify(detailTypeList))
					});
					0
					// window.localStorage.setItem('detailTypeList', JSON.stringify(detailTypeList))

					// window.location.href = './channel.html';

					// api.openWin({
					// 	name: 'channel',
					// 	url: 'channel.html',
					// 	reload: true,
					// 	slidBackEnabled: false,
					// 	pageParam: {
					// 		detailTypeList: detailTypeList
					// 	}
					// })
				},
				intoTypeByName(str) {
					var that = this;
					var f_l = that.typeList.filter(function(item) {
						return item.Name == str;
					})

					var detailTypeList = that.typeList.filter(function(item) {
						return item.ParentCategoryId == f_l[0].CategoryId;
					})
					for (var i in detailTypeList) {
						var node = [];
						for (var j in that.typeList) {
							if (detailTypeList[i].CategoryId == that.typeList[j].ParentCategoryId) {
								node.push(that.typeList[j])
							}
						}
						detailTypeList[i].typeNode = node;
					}
					// api.openWin({
					// 	name: 'channel',
					// 	url: 'channel.html',
					// 	reload: true,
					// 	slidBackEnabled: false,
					// 	pageParam: {
					// 		detailTypeList: detailTypeList
					// 	}
					// })
				},
				openUrl(row) {
					var that = this;
					if (row.AdLink) {
						if (row.AdLink.indexOf('http') > -1) {
							// api.openWin({
							// 	name: 'activityView',
							// 	url: 'activityView.html',
							// 	reload: true,
							// 	slidBackEnabled: false,
							// 	pageParam: {
							// 		url: row.AdLink
							// 	}
							// })
						} else if (row.AdLink.indexOf('detail') > -1) {
							var id = row.AdLink.split('|')[1];
							// api.openWin({
							// 	name: 'product',
							// 	url: 'product.html',
							// 	reload: true,
							// 	slidBackEnabled: false,
							// 	pageParam: {
							// 		productData: {
							// 			ProductId: id
							// 		},
							// 		stepIndex: 1
							// 	}
							// })
						}
					}

				},
				loginAPP() {
					// api.openWin({
					// 	name: 'login',
					// 	url: '../login.html',
					// 	animation: {
					// 		type: "movein", //动画类型（详见动画类型常量）
					// 		subType: "from_bottom", //动画子类型（详见动画子类型常量）
					// 		duration: 300 //动画过渡时间，默认300毫秒
					// 	},
					// 	reload: true,
					// 	slidBackEnabled: false
					// })
				},
				openWinPage(url) {
					var that = this;
					// api.openWin({
					// 	name: url,
					// 	url: url + '.html',
					// 	reload: true,
					// 	slidBackEnabled: false
					// })

				},
			}
		})
	</script>

</html>